package de.tabuma.soapforms.soapproject.view;

import de.tabuma.soapforms.*;
import de.tabuma.soapforms.soapproject.entity.*;
import de.tabuma.lib.tabumaview;
import java.io.PrintWriter;
import java.util.*;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author alefen
 */
public class remove extends tabumaview {

    public remove(String servlet, Hashtable parameter) {
        super(servlet, parameter);
    }

    @Override
    public void processRequest(ServletContext context, HttpServletRequest request, HttpServletResponse response, PrintWriter out) {
        String question = "Do you really want to remove project {1}?";
        String remove = "remove";
        String cancel = "cancel";

        SoapProject sp = (SoapProject) request.getAttribute(constants.soapProject);

        if(sp.getWsdlUrl()==null) {
            out.println(question.replaceAll("\\{1\\}", "null"));
        }
        else {
            out.println(question.replaceAll("\\{1\\}", sp.getWsdlUrl()));
        }
        out.println(this.getFormBeginn(null));
        out.println(this.getHiddenAsAttribute());
        out.println("<input type=\"hidden\" name=\""+constants.soapProjectId+"\" value=\""+sp.getId()+"\"/>");
        out.println("<input type=\"hidden\" name=\""+constants.removeSoapProject1+"\" value=\"true\"/>");
        out.println("<input type=\"submit\" name=\"remove\" value=\""+remove+"\" class=\"button\"/>");
        out.println("<input type=\"button\" name=\"back\" value=\""+cancel+"\" onClick=\"javascript:history.back()\" class=\"button\"/>");
        out.println(this.getFormEnd());
    }
}